﻿// -------------------------------------------------------------------------
//    @FileName         :    NFLogicConfig.h
//    @Author           :    gaoyi
//    @Date             :    24-8-15
//    @Email            :    445267987@qq.com
//    @Module           :    NFLogicConfig
//
// -------------------------------------------------------------------------

#pragma once

#include <proto_need.nanopb.h>
#include <NFComm/NFPluginModule/NFConfigDefine.h>
#include <NFLogicCommon/NFBaseDefine.h>

#include "NFComm/NFObjCommon/NFObject.h"
#include "NFLogicCommon/NFLogicShmTypeDefines.h"

class NFLogicConfig : public NF_OBJECT_GLOBAL_TEMPLATE_MACRO(NFLogicConfig, EOT_LOGIC_CONFIG_ID, NFObject)
public:
    NFLogicConfig();

    virtual ~NFLogicConfig();

    int CreateInit();

    int ResumeInit();

public:
    uint32_t LogOutFailRetryTime()
    {
        return m_config.m_dwLogOutFailRetryTime;
    }

    int32_t RoleDetailSaveTimeGap()
    {
        return m_config.m_iRoleDetailSaveTimeGap;
    }

    int32_t TickSaveRoleIndexGap()
    {
        return m_config.m_iTickSaveRoleIndexGap;
    }

    int32_t TickSaveRoleNum()
    {
        return m_config.m_iTickSaveRoleNum;
    }

    int32_t TickTransIndexGap()
    {
        return m_config.m_iTickTransIndexGap;
    }

    int32_t TickTransNum()
    {
        return m_config.m_iTickTransNum;
    }

    int32_t ServerStopKickNumPerLoop()
    {
        return m_config.m_iServerStopKickNumPerLoop;
    }

    int32_t ServerStopWaitTime()
    {
        return 0;
        //return m_config.m_iServerStopWaitTime;
    }

    int InTeamKeepAliveTime()
    {
        return m_config.m_iInTeamKeepAliveTime;
    }

    int32_t ClientRecvPacketFreqThresholdValue()
    {
        return m_config.m_uClientRecvPacketFreqThresholdValue;
    }

    int32_t ClientRecvWarningThresholdValue()
    {
        return m_config.m_uClientRecvWarningThresholdValue;
    }

    int32_t ClientRecvSameCmdIntervalTime()
    {
        return m_config.m_uClentRecvSameCmdIntervalTime;
    }

    int32_t ClentRecvFreqCycleTime()
    {
        return m_config.m_uClentRecvFreqCycleTime;
    }

    bool WhiteListLogin()
    {
        return m_config.operationConfig.m_bIsWhiteLogin;
    }

    bool IsNoToken()
    {
        return m_config.m_bNoToken;
    }

    bool NotCheckZone()
    {
        return m_config.m_bNotCheckZone;
    }

    //const char* GetGameBlogAddr()
    //{
    //    return m_cGameBlogAddr;
    //}

    bool IsForbidRegist()
    {
        return m_config.operationConfig.m_bForbidRegist;
    }

    bool IsRegistLimit()
    {
        return m_config.operationConfig.m_bIsRegistLimit;
    }

    bool IsCheckClientVersion()
    {
        return m_config.m_bIsCheckClientVersion;
    }

    int32_t GetQQRegistLimit()
    {
        return  m_config.operationConfig.m_iRegistLimit;
    }

    int32_t GetWXRegistLimit()
    {
        return  m_config.operationConfig.m_iRegistLimit;
    }

    int32_t GetPlatID()
    {
        return m_config.m_iPlatID;
    }

    int GetSessionPerSecond()
    {
        return m_config.operationConfig.m_sessionPerSecond;
    }

    int GetLoginLineMaxPlayer()
    {
        return std::min( m_config.operationConfig.m_iMaxOnline, (int32_t)m_pServerConfig->MaxOnlinePlayerNum);
    }

    int32_t GetTransferVersion(int iTransferID);

    bool CheckRegChannelWhite(const std::string& channel)
    {
        return false;
    }

    bool IsRegChannelOpen()
    {
        return m_config.operationConfig.m_bIsRegChannelOpen;
    }

    bool IsVersionZero(TClientVersion stVer)
    {
        return stVer.m_iBigVer == 0 && stVer.m_iMidVer == 0 && stVer.m_iMinVer == 0 && stVer.m_iBuildCnt == 0;
    }

    int GetIndulgeTime() { return m_config.m_iIndulgeTime; }

    void SetPacketRateCheck( bool bSet )
    {
        m_config.m_bPkgRateCheck = bSet;
    }

    bool IsPacketRateCheck()
    {
        return m_config.m_bPkgRateCheck;
    }

    uint32_t SessionHeartbeatTimeout()
    {
        return m_config.m_dwSessionHeartbeatTimeOut;
    }

    bool IsGmClosed()
    {
        return m_config.m_bIsGmClosed;
    }
public:
    NFLogicServerConfig m_config;
    NFServerConfig* m_pServerConfig;
};
